import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import babelPlugin from 'babel-plugin-import'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    react(),
    babelPlugin(
      {
        libraryName: '@arco-design/web-react',
        libraryDirectory: 'es',
        camel2DashComponentName: false,
        style: true, // 样式按需加载
      },
      {
        libraryName: '@arco-design/web-react/icon',
        libraryDirectory: 'react-icon',
        camel2DashComponentName: false,
      },
    ),
  ],
  css: {
    preprocessorOptions: {
      scss: {
        prependData: `@import "./src/style/base.scss";`,
      },
    },
  },
})
